﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Lexer.SyntaxTree
{
    /// <summary>
    /// The root of all nodes.  Simply contains a nextNode property.
    /// </summary>
    abstract class SyntaxNode
    {
        private SyntaxNode nextNode;
        public virtual SyntaxNode NextNode
        {
            get { return this.nextNode; }
            set { this.nextNode = value; }
        }
        /// <summary>
        /// Adds the next node to the end of the chain.
        /// </summary>
        /// <param name="node"></param>
        public void AddToEnd(SyntaxNode node)
        {
            if (this.nextNode == null)
                this.nextNode = node;
            else
                this.nextNode.AddToEnd(node);
        }
        public abstract override String ToString();
    }
}
